<%--    
创建时间：2017年10月16日上午10:38:52   
创 建 人：JobsZhang  
相关说明：   
JDK1.6.0_21 tomcat6.0.29 servlet2.5    
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>upload</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/webuploader.css" />
<!-- <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css" /> -->
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/webuploader.min.js" ></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/myupload.js" ></script>
<!-- <script type="text/javascript" src="bootstrap/js/bootstrap.js" ></script> -->
<style type="text/css">

</style>
<script type="text/javascript">
	$(function(){
		var opt1 = {
				server:CONTEXT_PATH+'/FileUpload/upload',
				swf:JS_PATH+'/webuploader/Uploader.swf',
				chunked:false,
		};
		$("#imgUplod").upload(opt1,function(data){
			console.log(data);
			$("#coverImg").val(data.data[0].realName);
		});
		var opt={
				auto:false,
				swf:"${pageContext.request.contextPath}/js/webuploader/js/Uploader.swf",
				chunked:true,
				chunkSize:5*1024*1024,
				server:"${pageContext.request.contextPath}/FileUpload/uploadFileChunks",
				accept: {
		                title: 'mediaFile',
		                extensions: 'gif,jpg,jpeg,bmp,png,3gp,mp4,rmvb,mov,avi,m4v,mp3',
		                mimeTypes: 'image/*,video/*,audio/*,application/*'
		             },
		       fileNumLimit:1, 
		       fileSizeLimit:9995*1024*1024,
		       fileSingleSizeLimit:9995*1024*1024,
		       threads:5,
	           //在上传当前文件时，准备好下一个文件
	           prepareNextFile:true,
	           fileCheckUrl:'${pageContext.request.contextPath}/FileUpload/fileCheck',//检测文件是否存在url
			   checkChunkUrl:'${pageContext.request.contextPath}/FileUpload/checkChunk',//检测分片url
			   mergeChunksUrl:'${pageContext.request.contextPath}/FileUpload/mergeChunks' //合并文件请求地址
			     
		};
	    $("#uploadFile").upload(opt,function(data){
	    	$("#uploadpath").val(data.uploadpath);
	    	$("#mediaTime").val(data.mediaTime);
	    });
	});
</script>
</head>
<body>
<p>不开启分片上传</p>
<div id="imgUplod"></div>
<hr>
<p>开启分片上传</p>
<div id="uploadFile"></div>

</body>
</html>